<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<jsp:include page="/WEB-INF/jspf/header.jsp">
    <jsp:param name="title" value="New Customer" />
</jsp:include>

<f:view>
    <h:form>
        <h:panelGrid columns="2" >

            <%@include file="/WEB-INF/jspf/menu_manager.jspf" %>
            <h:panelGroup>
                <h1>New Customer</h1>

                <h:panelGrid columns="3">
                    <h:outputText value="Login:"/>
                    <h:inputText id="login" value="#{customer.login}" label="login" title="Login" required="true" requiredMessage="The login field is required." />
                    <h:message for="login" errorClass="error" />
                    <h:outputText value="Password"/>
                    <h:inputText id="password" value="#{customer.password}" label="password" title="Password" required="true" requiredMessage="The password field is required." />
                    <h:message for="password" errorClass="error" />
                    <h:outputText value="First Name:"/>
                    <h:inputText id="firstName" value="#{customer.firstName}" label="firstName" title="FirstName" required="true" requiredMessage="The First Name field is required." />
                    <h:message for="firstName" errorClass="error"/>
                    <h:outputText value="Last Name:"/>
                    <h:inputText id="lastName" value="#{customer.lastName}" label="lastName" title="LastName" required="true" requiredMessage="The Last Name is required." />
                    <h:message for="lastName" errorClass="error"/>
                    <h:outputText value="Transaction Limit:"/>
                    <h:inputText id="limit" value="#{customer.limit}" label="limit" title="limit" required="true"  validatorMessage="Amount value is not correct."  requiredMessage="Value is required." >
                        <f:validateDoubleRange minimum="0.01"  />
                    </h:inputText>
                    <h:message for="limit" errorClass="error"/>
                    <h:outputText value="Limit Currency:"/>
                    <h:selectOneMenu validatorMessage="Currency Error" requiredMessage="Currency Error." id="currency" required="true" value="#{customer.currencyLimit}">
                        <f:converter converterId="CurrencyConverter" />
                        <f:selectItems value="#{account.currencyChoices}" />
                    </h:selectOneMenu>
                    <h:message infoClass="info" errorClass="error" for="currency"/>

                </h:panelGrid>
                <h:commandButton action="#{customer.create}" value="Add"/>

            </h:panelGroup>
        </h:panelGrid>
    </h:form>
    </body>
    </html>

</f:view>
